<?php

	session_start();
	if(!array_key_exists("user", $_SESSION) || $_SESSION['account'] != 2){
	header("Location: ../common/redirect.php");
	exit;
}
	
	include_once("../class/db.php");
	$db = new db();
	$sql = "SELECT * FROM course WHERE link = '".$_SESSION['link']."'";
	$data = $db->execute($sql, "onerow");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PIE EDUCATION | Educational Network</title>
<link rel="stylesheet" type="text/css" href="/css/style-student.css" />
<script type="text/javascript" src="/js/index.js"></script>
<script language="Javascript1.2">
<!--
setTimeout('location.href="/logout.php?expire=1"',600000);
// -->
</script>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-35230372-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#000000"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="350" height="30">&nbsp;</td>
        <td align="right" valign="bottom"><a href="class.php" class="top-menu" style="color:#999">MY CLASS</a> <a href="schedule.php" class="top-menu" style="color:#999">CALENDAR</a> <a href="homework.php" class="top-menu" style="color:#999">HOMEWORK</a> <a href="test.php" class="top-menu" style="color:#999">EXAMS</a> <a href="grades.php" class="top-menu" style="color:#999">GRADES</a> <a href="tools.php" class="top-menu" style="color:#999">TOOLS</a> <a href="/logout.php" class="top-menu" style="color:#999">SIGN OUT</a></td>
      </tr>
	  <tr>
        <td>&nbsp;</td>
        <td align="right" valign="bottom"><a href="/profile/" class="login-menu" style="color:#FFF"><?php echo $_SESSION['name'].' '.$_SESSION['lname']; ?></a> <a href="/common/redirect.php" class="login-menu" style="color:#FFF">My Documents</a> <a href="/network/" class="login-menu" style="color:#FFF">My Wall</a> <a href="/common/settings.php" class="login-menu" style="color:#FFF">Settings</a></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="30" style="background-image:url(/images/top-bg-student.png); background-repeat:repeat-x">&nbsp;</td>
  </tr>
  <tr>
    <td height="550" align="center" valign="top"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td height="80"><img src="../images/course-ready.png" width="980" height="50" alt="Your Course is Ready" /></td>
      </tr>
      <tr>
        <td style="font-size:14px; color:#999">Congratulations, your course is now live, spread the word. Below you can review all your course content at a glance, if you want to make any change, just click on the link &quot;My Class&quot; from the top menu and then select the course you want to modify.</td>
      </tr>
      <tr>
        <td><table width="700" border="0" align="center" cellpadding="4" cellspacing="2">
          <tr>
            <td width="200" align="right"><strong>Name</strong></td>
            <td><?php echo $data['name']; ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Category</strong></td>
            <td><?php echo $data['category']; ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Description</strong></td>
            <td align="justify"><?php echo $data['description']; ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Start Date</strong></td>
            <td><?php echo $data['start_date']; ?></td>
          </tr>
          <tr>
            <td align="right"><strong>End Date</strong></td>
            <td><?php echo $data['end_date']; ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Grade Format</strong></td>
            <td><?php if($data['grade_format'] == 1){ echo "A-F Format"; } else { echo "Percentage Format"; } ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Active</strong></td>
            <td><?php if($data['active'] == 1){ echo "The course active"; } else { echo "The course is inactive"; } ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Prerequisites Validation</strong></td>
            <td><?php if($data['prerequisites_validation'] > 0){ echo "Yes"; } else { echo "No"; } ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Prerequisites Description</strong></td>
            <td><?php echo $data['prerequisites']; ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Affiliate Associated</strong></td>
            <td><?php if($data['affiliate'] > 0){ echo "Yes"; } else { echo "No"; } ?></td>
          </tr>
          <tr>
            <td align="right"><strong>Affiliate Percentage</strong></td>
            <td><?php echo $data['affiliate']; ?>%</td>
          </tr>
          </table>
          <table width="700" border="0" align="center" cellpadding="4" cellspacing="4">
          <?php  
		  	$sql = "SELECT * FROM course_modules WHERE link = '".$_SESSION['link']."' and owner = {$_SESSION['user']} ORDER BY order_number ASC";
			$course_modules = $db->execute($sql, "all");
			if($course_modules != false){
			foreach($course_modules as $module_row){
				echo '<tr>
				  <td bgcolor="#CCCCCC" style="font-family:Arial, Helvetica, sans-serif; font-size:14px"><strong>'.$module_row['title'].'</strong></td>
				</tr>';
			$sql = "SELECT * FROM course_content WHERE uid = {$module_row['id']} and owner = {$_SESSION['user']} ORDER BY order_number ASC";
			$course_modules_content = $db->execute($sql, "all");
			if($course_modules_content != false){
				foreach($course_modules_content as $module_content){
					echo '<tr>
					  <td style="padding-left:50px">'.$module_content['title'].'</td>
					</tr>';
				}
			}
			}
			}
            ?>
          </table></td>
      </tr>
</table></td>
      </tr>
  <tr>
    <td height="30" align="center" style=" background-image:url(../images/bottom-bg-student.png); background-repeat:repeat-x;">&nbsp;</td>
  </tr>
  <tr>
    <td height="50" align="center" bgcolor="#000000" style="color:#fff; font-family:Arial, Helvetica, sans-serif">PIE.EDU All Rights Reserved 2012<br />
      <a href="/common/privacy.php" class="bottom-menu" style="color:#999">Privacy Policy</a> | <a href="/common/terms.php" class="bottom-menu"  style="color:#999">Terms of Use</a> | <a href="/help/main.php" class="bottom-menu" style="color:#999">Help Center</a> | <a href="/common/jobs.php" class="bottom-menu" style="color:#999">Jobs</a></td>
  </tr>
    </table>
</body>
</html>